package com.stu.JdbcTx;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service("serviceProxy")
public class AccountServiceImpl implements AccountService {

	@Autowired
	private AccountDao accountDao;
	@Override
	@Transactional(isolation = Isolation.DEFAULT,readOnly = false,propagation = Propagation.REQUIRED)
	public void transfer(String outer, String inner, Integer money) {
		// 转出
		accountDao.out(outer, money);
		//异常发生
		//int i=1/0;
		//转进
		accountDao.in(inner, money);
	}

}
